﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Collections.Generic;

namespace OxyPlotTest
{
    class MainViewModel
    {

        private int mSeed;
        private Random mRandom;

        public MainViewModel(int nSeed)
        {
            mSeed = nSeed;
            mRandom = new Random(mSeed);


            this.mListDataInfo = new List<DataInfo>();
              


            int xValue = 0;//DateTime.Now.Second;//DateTime.Today.Add(TimeSpan.FromHours(9));
            for (var pointIndex = 0; pointIndex < 6; pointIndex++)
            {
                int XPointValue = xValue;
                int yPointValue = mRandom.Next(mSeed);
                DataInfo dataInfo = new DataInfo(XPointValue, yPointValue);
                this.mListDataInfo.Add(dataInfo);
                xValue = xValue + 10;//dateTime.AddMinutes(1);
            }
        }

        public void Refresh(int nSeed)
        {

            int nCount = mListDataInfo.Count - 1;
            for (int index = 0; index < nCount; index++)
            {
                this.mListDataInfo[index].XPointValue = this.mListDataInfo[index + 1].XPointValue-10;
                this.mListDataInfo[index].yPointValue = this.mListDataInfo[index + 1].yPointValue;
       
            }



            this.mListDataInfo[nCount].XPointValue = 60;
            this.mListDataInfo[nCount].yPointValue = mRandom.Next(mSeed);
        }
        public List<DataInfo> mListDataInfo { get; private set; }

    }


    public class DataInfo
    {
        public int XPointValue { get; set; }
        public int yPointValue { get; set; }
        public DataInfo(int _XPointValue, int _yPointValue)
        {
            XPointValue = _XPointValue;
            yPointValue = _yPointValue;
        }
    }
}

